<?php
	/**
	* 
	*/
	class Admin extends CI_Controller
	{
		public $data=array();

		function __construct()
		{
			parent::__construct();	
			$this->load->model('General_model');
			$this->folder     = "admin/";				
			$this->data["systemname"]=$this->General_model->get_sysparameter("systemname");
			$this->data["copyright"]=$this->General_model->get_sysparameter("copyright");
			$this->data["logo"]=$this->General_model->get_sysparameter("logo");
			$this->data["webroot"]=$this->General_model->get_sysparameter("webroot");
			$this->data["web_license"]=$this->General_model->get_sysparameter("web_license");
			$this->data["systemdescription"]=$this->General_model->get_sysparameter("systemdescription");
			$this->data["systemkeywords"]=$this->General_model->get_sysparameter("systemkeywords");
			$this->data["authorization"]=$this->General_model->get_sysparameter("authorization");
		}
		function index(){
			$post=$this->input->post();			
			if (!empty($post["username"]) && !empty($post["password"])) {
				if ($this->General_model->enterprise_login("admin",$post["username"],$post["password"])) {
					$_SESSION["username"]=$post["username"];
					redirect('admin/admin/login/'.$_SESSION["username"]);
				}
			}
			$data=array();			
			$this->load->view($this->folder.'adminindex', $this->data);
		}
		function login(){
			if ($this->General_model->checkauth("admin",$_SESSION["username"])) {
			$this->data["username"]=$_SESSION["username"];			}
			$this->load->view($this->folder.'general/htmlhead',  $this->data);
			$this->load->view($this->folder.'general/bodyheader',  $this->data);
			$this->load->view($this->folder.'general/bodysidebar',  $this->data);
			$this->load->view($this->folder.'general/bodycontent',  $this->data);
			$this->load->view($this->folder.'general/htmlfoot',  $this->data);
		}
			//管理员后台的注销
		function logout()
		{
			unset($_SESSION["username"]);
			redirect('admin/admin');
		}
	}
?>